Avoid a critical warning in the filechooser portal
authorMatthias Clasen <mclasen@redhat.com>
Fri, 17 Mar 2017 23:56:33 +0000 (19:56 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 19 Mar 2017 11:34:21 +0000 (07:34 -0400)
This was showing up when cancelling a portal file chooser
in recipes.

gtk/gtkfilechoosernativeportal.c

index 981e0d5471c42eb79bf9fdc0d4d324a7d776ccc9..45ceb3f4cfd809a5a360d6e447d159ec207289c8 100644 (file)
@@ -110,15 +110,17 @@ response_cb (GDBusConnection  *connection,
 
   choices = g_variant_lookup_value (response_data, "choices", G_VARIANT_TYPE ("a(ss)"));
   if (choices)
-    for (i = 0; i < g_variant_n_children (choices); i++)
-      {
-        const char *id;
-        const char *selected;
-        g_variant_get_child (choices, i, "(&s&s)", &id, &selected);
-        gtk_file_chooser_set_choice (GTK_FILE_CHOOSER (self), id, selected);
-      }
-
-  g_variant_unref (choices);
+    {
+      for (i = 0; i < g_variant_n_children (choices); i++)
+        {
+          const char *id;
+          const char *selected;
+          g_variant_get_child (choices, i, "(&s&s)", &id, &selected);
+          gtk_file_chooser_set_choice (GTK_FILE_CHOOSER (self), id, selected);
+        }
+      g_variant_unref (choices);
+    }
+
   g_slist_free_full (self->custom_files, g_object_unref);
   self->custom_files = NULL;
   for (i = 0; uris[i]; i++)